<template>
  <div>
    <Content :style="{minHeight: '400px'}">
      <div class="layout-content">
        <Affix>
          <div class="page-header shadow">
            <span class="pull-left title"><Icon type="ios-book-outline"></Icon> 试卷编辑 <small>(尚未上传至资料库)</small></span>
            <div class="pull-right">
              <ul>
                <li><Button type="text" icon="plus" size="small" @click="unshiftSubject">添加一题</Button></li>
                <li><Button type="text" icon="printer" size="small">保存</Button></li>
                <li><Button type="text" icon="pie-graph" size="small">统计</Button></li>
                <li><Button type="text" icon="ios-cloud-upload" size="small">导入</Button></li>
              </ul>
            </div>
          </div>
        </Affix>
        <Paper></Paper>
      </div>

    </Content>
  </div>
</template>
<script>
import Paper from '@/components/Paper'
export default{
  components: {
    Paper
  },
  created() {
    //将服务器的试卷初始化至vuex中
    this.$store.commit('setPaper', [])
  },
  methods: {
    //添加题目
    unshiftSubject() {
      if (!this.$store.state.testPapers.status) {
        this.$Message.error('请完成当前新增题型');
        return
      }
      this.$store.commit('addPaper', 0)
    },
  }
}
</script>
